package plataforma.cih.campos;

import java.util.Date;

import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.Datebox;

public class CampoData extends Datebox {

	boolean isDataFim = false;

	boolean isDataInicio = false;

	public CampoData(){
		
		setWidth("125px");
	}

	@Override
	public Date getValue() throws WrongValueException {

		Date data = super.getValue();
		if (data != null) {
			if (isDataFim) {

				data.setHours(23);
				data.setMinutes(59);
				data.setSeconds(59);
			}

			if (isDataInicio) {

				data.setHours(0);
				data.setMinutes(0);
				data.setSeconds(0);
			}
		}

		return data;
	}

	public boolean isDataFim() {
		return isDataFim;
	}

	public void setDataFim(boolean isDataFim) {
		this.isDataFim = isDataFim;
	}
	
	public boolean isDataInicio() {
		return isDataInicio;
	}

	public void setDataInicio(boolean isDataInicio) {
		this.isDataInicio = isDataInicio;
	}

}
